<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>低位龙头股分析平台</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        body {
            font-family: "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
            background-color: #f8f9fa;
        }

        .header {
            background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
            color: white;
            padding: 2rem 0;
            margin-bottom: 2rem;
        }

        .analysis-card {
            transition: transform 0.3s ease;
            margin-bottom: 1.5rem;
            border: none;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .analysis-card:hover {
            transform: translateY(-5px);
        }

        .score-badge {
            position: absolute;
            top: -10px;
            right: -10px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #28a745;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 1.1rem;
        }

        .chart-container {
            padding: 1rem;
            background-color: white;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            margin-bottom: 2rem;
        }

        .feature-label {
            font-size: 0.85rem;
            color: #6c757d;
        }

        .feature-value {
            font-size: 1.1rem;
            font-weight: 600;
        }

        .industry-tag {
            font-size: 0.8rem;
            padding: 0.25rem 0.5rem;
            background-color: #e9ecef;
            border-radius: 0.25rem;
            margin-right: 0.5rem;
        }

        .card-header {
            background-color: #f8f9fa;
            border-bottom: none;
        }

        .progress {
            height: 0.6rem;
        }
    </style>
</head>

<body>
    <header class="header">
        <div class="container text-center">
            <h1><i class="bi bi-graph-up-arrow"></i> 低位龙头股分析平台</h1>
            <p class="lead">发现潜在的低位龙头股，把握投资机会</p>
        </div>
    </header>

    <div class="container">
        <div class="row mb-4">
            <div class="col-md-12">
                <div class="alert alert-info" role="alert">
                    <i class="bi bi-info-circle-fill"></i>
                    低位龙头股是指在行业内具有领先地位，但当前股价处于相对低位的股票。这类股票具有较高的投资价值和反弹潜力。
                </div>
            </div>
        </div>

        <div class="row mb-4">
            <div class="col-md-12">
                <div class="card chart-container">
                    <div class="card-header d-flex justify-content-between align-items-center">
                        <h5 class="mb-0">综合评分排行</h5>
                        <span class="text-muted">更新时间: {{ update_time }}</span>
                    </div>
                    <div class="card-body">
                        <img src="/static/images/low_position_leaders_scores.png" class="img-fluid" alt="低位龙头股评分排行">
                    </div>
                </div>
            </div>
        </div>

        <div class="row mb-4">
            <div class="col-md-6">
                <div class="card chart-container">
                    <div class="card-header">
                        <h5 class="mb-0">多维度评分对比</h5>
                    </div>
                    <div class="card-body">
                        <img src="/static/images/low_position_leaders_radar.png" class="img-fluid" alt="多维度评分对比">
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card chart-container">
                    <div class="card-header">
                        <h5 class="mb-0">行业分布</h5>
                    </div>
                    <div class="card-body">
                        <img src="/static/images/predicted_low_leaders_industry.png" class="img-fluid" alt="行业分布">
                    </div>
                </div>
            </div>
        </div>

        <h2 class="mb-4">预测的低位龙头股</h2>

        <div class="row">
            {% for stock in predicted_leaders %}
            <div class="col-md-4">
                <div class="card analysis-card">
                    <div class="score-badge">{{ stock.adjusted_score|round|int }}</div>
                    <div class="card-header">
                        <h5 class="mb-0">{{ stock.name }} ({{ stock.code }})</h5>
                        <span class="industry-tag">{{ stock.industry }}</span>
                    </div>
                    <div class="card-body">
                        <div class="row mb-2">
                            <div class="col-6">
                                <div class="feature-label">PE</div>
                                <div class="feature-value">{{ stock.pe_ttm|round(2) }}</div>
                            </div>
                            <div class="col-6">
                                <div class="feature-label">历史价格比</div>
                                <div class="feature-value">{{ (stock.price_to_historical_ratio * 100)|round|int }}%
                                </div>
                            </div>
                        </div>
                        <div class="row mb-2">
                            <div class="col-6">
                                <div class="feature-label">行业排名</div>
                                <div class="feature-value">{{ stock.industry_rank }}</div>
                            </div>
                            <div class="col-6">
                                <div class="feature-label">收入增长</div>
                                <div class="feature-value">{{ stock.income_yoy|round(2) }}%</div>
                            </div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-6">
                                <div class="feature-label">下跌天数</div>
                                <div class="feature-value">{{ stock.downtrend_days }} 天</div>
                            </div>
                            <div class="col-6">
                                <div class="feature-label">历史涨幅</div>
                                <div class="feature-value">{{ stock.historical_rise|round(2) }}%</div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>成长性</small>
                                <small>{{ stock.growth_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-success" role="progressbar"
                                    style="width: {{ stock.growth_score }}%"></div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>价值</small>
                                <small>{{ stock.value_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-info" role="progressbar"
                                    style="width: {{ stock.value_score }}%"></div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>技术面</small>
                                <small>{{ stock.technical_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-warning" role="progressbar"
                                    style="width: {{ stock.technical_score }}%"></div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>行业地位</small>
                                <small>{{ stock.industry_position_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-danger" role="progressbar"
                                    style="width: {{ stock.industry_position_score }}%"></div>
                            </div>
                        </div>

                        <div>
                            <div class="d-flex justify-content-between">
                                <small>低估程度</small>
                                <small>{{ stock.underestimation_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-primary" role="progressbar"
                                    style="width: {{ stock.underestimation_score }}%"></div>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer text-end">
                        <span class="text-muted">行业热度加成: +{{ stock.heat_bonus|round|int }}</span>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>

        <hr class="my-5">

        <h2 class="mb-4">候选低位龙头股</h2>

        <div class="row">
            {% for stock in candidates %}
            <div class="col-md-4">
                <div class="card analysis-card">
                    <div class="score-badge">{{ stock.total_score|round|int }}</div>
                    <div class="card-header">
                        <h5 class="mb-0">{{ stock.name }} ({{ stock.code }})</h5>
                        <span class="industry-tag">{{ stock.industry }}</span>
                    </div>
                    <div class="card-body">
                        <div class="row mb-2">
                            <div class="col-6">
                                <div class="feature-label">PE</div>
                                <div class="feature-value">{{ stock.pe_ttm|round(2) }}</div>
                            </div>
                            <div class="col-6">
                                <div class="feature-label">历史价格比</div>
                                <div class="feature-value">{{ (stock.price_to_historical_ratio * 100)|round|int }}%
                                </div>
                            </div>
                        </div>
                        <div class="row mb-2">
                            <div class="col-6">
                                <div class="feature-label">行业排名</div>
                                <div class="feature-value">{{ stock.industry_rank }}</div>
                            </div>
                            <div class="col-6">
                                <div class="feature-label">收入增长</div>
                                <div class="feature-value">{{ stock.income_yoy|round(2) }}%</div>
                            </div>
                        </div>
                        <div class="row mb-3">
                            <div class="col-6">
                                <div class="feature-label">下跌天数</div>
                                <div class="feature-value">{{ stock.downtrend_days }} 天</div>
                            </div>
                            <div class="col-6">
                                <div class="feature-label">历史涨幅</div>
                                <div class="feature-value">{{ stock.historical_rise|round(2) }}%</div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>成长性</small>
                                <small>{{ stock.growth_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-success" role="progressbar"
                                    style="width: {{ stock.growth_score }}%"></div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>价值</small>
                                <small>{{ stock.value_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-info" role="progressbar"
                                    style="width: {{ stock.value_score }}%"></div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>技术面</small>
                                <small>{{ stock.technical_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-warning" role="progressbar"
                                    style="width: {{ stock.technical_score }}%"></div>
                            </div>
                        </div>

                        <div class="mb-2">
                            <div class="d-flex justify-content-between">
                                <small>行业地位</small>
                                <small>{{ stock.industry_position_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-danger" role="progressbar"
                                    style="width: {{ stock.industry_position_score }}%"></div>
                            </div>
                        </div>

                        <div>
                            <div class="d-flex justify-content-between">
                                <small>低估程度</small>
                                <small>{{ stock.underestimation_score|round|int }}/100</small>
                            </div>
                            <div class="progress">
                                <div class="progress-bar bg-primary" role="progressbar"
                                    style="width: {{ stock.underestimation_score }}%"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>

    <footer class="bg-dark text-white py-4 mt-5">
        <div class="container text-center">
            <p>© 2025 低位龙头股分析平台 | 数据仅供参考，不构成投资建议</p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>